#ifndef BUILDER_H
#define BUILDER_H

#include <QObject>
#include <QDebug>
#include <QFile>
#include <QDir>
#include <QProcess>
#include <QMessageBox>
#include <QCryptographicHash>
#include "../FileView/UpdateFile.h"
#include "../Archiver/InterfaceArchiver.h"

class Builder: public QObject
{
	Q_OBJECT
	
public:
	Builder();
	virtual ~Builder();
	void setLists(QList<UpdateFile*> Files);  //Insère la liste des mises à jour
	void setPathXML(QString xmlPath);         //Insère le path du fichier XML
	void setPathUpdater(QString updaterPath); //Insère le path du fichier Updater
	QList<UpdateFile*> getXMLList();          //Récupère la liste prète du fichier XML
	void Build();                             //Génère les fichiers
signals:
	void CanYouShowErrorMsg(QString msg);
	void CanYouShowMsg(QString msg);
	void CanYouShowProgress(int value, int value_max);
	
private slots:
	void BuildNextFile(QString OutputFilePath = "", bool ExitStatut = "true");
private:
	void Debug_ShowLists();
	void CreateAndConfigureListXML();
	QString CalcSha1(QString Path);
	QList<UpdateFile*> ListTocreateXML;
	QList<UpdateFile*> ListToUpdate;
	QString XML_Path;
	QString Updater_Path;
	int ID_CurrentFile;
	//QProcess *SevenZip;
	InterfaceArchiver *Archiver;
};

#endif // BUILDER_H
